<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../react18/react.development.js"></script>
    <script src="../react18/react-dom.development.js"></script>
    <script src="../react18/babel.min.js"></script>
  </head>
  <body>
    <div id="app"></div>
    <script type="text/babel">
      class MySelf extends React.Component {
        render() {
          console.log(this);
          let { name, age, sex } = this.props.item;
          return (
            <div>
              <h2>
                <h2>我的名字是{name},年龄是{age},我的性别是{sex}</h2>
              </h2>
            </div>
          );
        }
      }
      class App extends React.Component {
        state = {
          students: [
            { id: 1, name: "张三", age: 18, sex: "男" },
            { id: 2, name: "李四", age: 20, sex: "女" },
            { id: 3, name: "王五", age: 12, sex: "女" },
          ],
        };
        render() {
            const   {students} = this.state
          return (
            <ul>
              {
                students.map(item=>{
                    return  <li key={item.id}>
                        <h1>以下是{item.name}的自我介绍</h1>
                        <MySelf item={item}/>
                        </li>
                })
              }
     
            </ul>
          );
        }
      }
      ReactDOM.createRoot(document.getElementById("app")).render(<App />);
    </script>
  </body>
</html>
